<!--
 * @Author: your name
 * @Date: 2021-03-15 20:53:56
 * @LastEditTime: 2021-03-15 20:56:17
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edi
 * @FilePath: \study\js\面试题\数组计算.html
-->
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>

    <body>
        <p>乘法口诀</p>
        <script>
            // 递归;
            function calc(num = 1) {
                console.log('num -----------', num);
                let st = ``;
                for (let k = 1; k <= num; k++) {
                    st += `${k} * ${num} = ${num * k}   `;
                }
                console.log(st);
                document.write(`<p>${st}</p>`);
                if (num < 9) calc(num + 1);
            }
            calc();
        </script>
    </body>
</html>
